package org.neuedu.chapter09_0629.demo06;

public class StringDemo01 {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "Hello";
        System.out.println(str1.equals(str2));// false
        System.out.println(str1.equalsIgnoreCase(str2));// true

        // StringBuffer,StringBuilder都没有重写equals
        StringBuffer str3 = new StringBuffer("hello");
        StringBuffer str4 = new StringBuffer("hello");
        System.out.println(str3.equals(str4));// false
        //  StringBuffer,StringBuilder 比较时，需要先转成String
        String s1 = str3.toString();
        String s2 = str4.toString();
        System.out.println(s1.equals(s2));// true
    }
}
